package com.hhkj.admin.train.common.mybatis.handler;

import com.alibaba.fastjson2.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.hhkj.admin.train.domain.TrainStudentAnswer;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;

import java.util.List;


/**
 * QuestionListHandler
 *
 * @author ByChen
 * @since 2023/05/24
 */
@Slf4j
@MappedJdbcTypes(JdbcType.VARCHAR)
public class TrainStudentAnswerListHandler extends AbstractJsonTypeHandler<List<TrainStudentAnswer>>
{
    @Override
    protected List<TrainStudentAnswer> parse(String json)
    {
        return JSONArray.parseArray(json, TrainStudentAnswer.class);
    }

    @Override
    protected String toJson(List<TrainStudentAnswer> obj)
    {
        return JSONArray.toJSONString(obj);
    }
}
